<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Microsoft.Samples.ServiceHosting.StorageClient.Message>>" %>

<%@ Import Namespace="WASM.WebSite.Logic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Message List
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>
		Message List</h2>
	<% using (Html.BeginForm("MessageCreate", "Queue", new { storageId = ViewData["storageId"], storageBoxId = ViewData["storageBoxId"] }))
		{  %>
	<table>
		<tr>
			<th>
				#
			</th>
			<th>
				Id
			</th>
			<th>
				Expiration Time
			</th>
			<th>
				Message
			</th>
		</tr>
		<%
			int i = 0;
			foreach (var item in Model)
			{
				i++;%>
		<tr>
			<td>
				<%=i.ToString() %>
			</td>
			<td>
				<%= Html.Encode(item.Id)%>
			</td>
			<td>
				<%= Html.Encode(item.ExpirationTime.ToLongTimeString() )%>
			</td>
			<td>
				<label title="<%= Html.Encode(item.ContentAsString()) %>">
					<%= Html.Encode(item.ShorterString(20))%>
				</label>
			</td>
		</tr>
		<%}%>
	</table>
	<p>
		<%= Html.ActionLink("Delete Top Message", "MessageDelete", new { storageId = ViewData["storageId"], storageBoxId = ViewData["storageBoxId"]})%>
	</p>
	<p>
		Add Message to Queue:
		<br />
		<%= Html.TextArea("messageContent", new { wight = "200px", Rows = "5" })%>
		<br />
		<input type="submit" value="Add" />
	</p>
	<%} %>
	<div>
		<%=Html.ActionLink("Back to List of Containers", "List", new { storageId = ViewData["storageId"] })%>
	</div>
</asp:Content>
